import React from 'react';
import User from '@/views/pages/user';
import UserDetails from '@/views/pages/user/details';
import EditUser from '@/views/pages/user/edit';
import WebView from '@/views/webview';
const Login = React.lazy(() => import('@/views/login'));
// 文件放到pages文件夹下面的就是都是要登录的，跟pages是不需要登录就能进去的页面
const Index = React.lazy(() => import('@/views/pages/index'));
const Dashboard = React.lazy(() => import('@/views/pages/dashboard/index'));
const TestProblem = React.lazy(() => import('@/views/pages/testProblem/index'));
const ScoreResult = React.lazy(() => import('@/views/pages/scoreResult/index'));
const PillarsOf = React.lazy(() => import('@/views/pages/pillarsOf/index'));
const Article = React.lazy(() => import('@/views/pages/article/index'));
export interface RouteConfigDeclaration {
    /**
     * 当前路由路径
     */
    path: string;
    /**
     * 当前路由名称
     */
    name?: string;
    /**
     * 是否严格匹配路由
     */
    exact?: boolean;
    /**
     * 是否需要路由鉴权
     */
    auth?: boolean;
    /**
     * 是否需要路由重定向
     */
    isRedirect?: boolean;
    /**
     * 是否需要动态加载路由
     */
    isDynamic?: boolean;
    /**
     * 动态加载路由时的提示文案
     */
    loadingFallback?: string;
    /**
     * 路由组件
     */
    component: any;
    /**
     * 子路由
     */
    childrens?: RouteConfigDeclaration[];
    KeepAlive?: boolean;
}
const routes: RouteConfigDeclaration[] = [
    {
        path: '/login',
        component: Login,
        exact: true,
        auth: false,
    },
    {
        path: '/webView',
        component: WebView,
        exact: true,
        auth: false,
    },
    {
        path: '/*',
        component: Index,
        exact: false,
        childrens: [
            {
                path: '/user',
                name: 'User',
                component: User,
                exact: true,
            },
            { path: '/user/detail', name: 'UserDetails', component: UserDetails, exact: true },
            { path: '/user/edit', name: 'EditUser', component: EditUser, exact: true },
            {
                path: '/dashboard',
                name: 'dashboard',
                component: Dashboard,
                exact: true,
            },
            {
                path: '/testProblem',
                name: 'testProblem',
                component: TestProblem,
                exact: true,
            },
            {
                path: '/scoreResult',
                name: 'scoreResult',
                component: ScoreResult,
                exact: true,
            },
            {
                path: '/pillarsOf',
                name: 'pillarsOf',
                component: PillarsOf,
                exact: true,
            },
            {
                path: '/article',
                name: 'article',
                component: Article,
                exact: true,
            },
        ],
    },
];

export default routes;
